<template>
  <div>
    <el-form ref="searchForm" :inline="true" :model="searchData" class="ele-form-search">
      <el-form-item>
        <el-select v-model="searchData.field_id" placeholder="请选择地块" filterable clearable style="width:240px">
          <el-option
            v-for="(item,index) in fields"
            :key="index"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-date-picker
          v-model="searchData.created_at"
          type="daterange"
          range-separator=" ~ "
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          clearable
        />
      </el-form-item>
      <el-form-item>
        <el-button class="ele-btn-icon" icon="el-icon-search" type="primary" @click="search">查询</el-button>
        <el-button type="default" @click="reset('searchForm')">重置</el-button>
        <el-button type="success" icon="el-icon-download" style="float:right;">导出数据</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchData: {
        field_id: '',
        created_at: ''
      },
      fields: [
        {
          id: 1, name: '地块1'
        },
        {
          id: 2, name: '地块2'
        }
      ]
    }
  },
  methods: {
    search() {
      this.$emit('search', this.searchData)
    },
    reset() {
      this.$emit('reset')
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
